]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
automountManager: Add handling of udisks errors for no/wrong passwords
authorSebastian Pinnau <spinnau@gmail.com>
Thu, 11 Oct 2018 17:14:25 +0000 (19:14 +0200)
committerSebastian Pinnau <spinnau@gmail.com>
Tue, 23 Oct 2018 22:13:10 +0000 (00:13 +0200)
If no password or a wrong password is entered after automounting an
encrypted device, then the password should be reasked. However, this
does not happen because the relevant udisks error messages for this
cases are missing in the exception handler that calls _reaskPassword.

Fix this issue by adding the relevant udisks error strings to the
exception handling in the _onVolumeMounted method.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/640

js/ui/components/automountManager.js

index 3e2dcd9238b24ff598217fe5620149f34c57596e..a64fc0d35065d14a2f66bd18d51f8d282ec14cce 100644 (file)
@@ -197,9 +197,13 @@ var AutomountManager = new Lang.Class({
             this._closeOperation(volume);
         } catch (e) {
             // FIXME: we will always get G_IO_ERROR_FAILED from the gvfs udisks
-            // backend in this case, see 
-            // https://bugs.freedesktop.org/show_bug.cgi?id=51271
-            if (e.message.indexOf('No key available with this passphrase') != -1) {
+            // backend, see https://bugs.freedesktop.org/show_bug.cgi?id=51271
+            // To reask the password if the user input was empty or wrong, we
+            // will check for corresponding error messages. However, these
+            // error strings are not unique for the cases in the comments below.
+            if (e.message.includes('No key available with this passphrase') || // cryptsetup
+                e.message.includes('No key available to unlock device') ||     // udisks (no password)
+                e.message.includes('Error unlocking')) {                       // udisks (wrong password)
                 this._reaskPassword(volume);
             } else {
                 if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))